<template>
  <div class="step-bar">
    <div v-for="(step, index) in steps" :key="index" class="step" :class="getStepClass(index)">
      <div class="dot">
        <span v-if="index < currentStep">✓</span>
        <span v-else>{{ index + 1 }}</span>
      </div>
      <div class="name">{{ step }}</div>
      <div v-if="index < steps.length - 1" class="line" />
    </div>
  </div>
</template>

<script setup>
import { computed } from 'vue'

const props = defineProps({
  steps: {
    type: Array,
    required: true,
    default: () => []
  },
  currentStep: {
    type: Number,
    required: true,
    default: 0
  }
})

const getStepClass = (index) => {
  if (index < props.currentStep) {
    return 'completed'
  }
  if (index === props.currentStep) {
    return 'active'
  }
  return ''
}
</script>

<style scoped lang="scss">
.step-bar {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  background: white;
  padding: 30px 40px;
  border-radius: 8px;
  margin-bottom: 20px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  position: relative;
}

.step {
  display: flex;
  align-items: center;
  position: relative;
  z-index: 1;

  .dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e0e0e0;
    border: 2px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    color: #999;
    font-size: 14px;
    flex-shrink: 0;
  }

  .name {
    font-size: 14px;
    color: #999;
    white-space: nowrap;
    margin-left: 8px;
  }

  .line {
    width: 80px;
    height: 1px;
    background: #e0e0e0;
    margin: 0 20px;
  }

  &.completed .dot {
    background: #409eff;
    border-color: #409eff;
    color: white;
  }

  &.completed .name {
    color: #409eff;
  }

  &.active .dot {
    background: #409eff;
    border-color: #409eff;
    color: white;
  }

  &.active .name {
    color: #409eff;
    font-weight: 500;
  }

  &:last-child .line {
    display: none;
  }
}
</style>

